#ifndef VERTEX_H
#define VERTEX_H

#include <cstdint>
#include <tuple>

class Vertex
{
public:
    enum Type : uint8_t
    {
        texture = 0,
        color = 1
    };
    inline Vertex(float x, float y, float z, float u, float v)
    {
        type = texture;
        ptr = new float[5]{ x, y, z, u, v };
    }
    inline Vertex(float x, float y, float z, float r, float g, float b)
    {
        type = color;
        ptr = new float[6]{ x, y, z, r, g, b };
    }
    Vertex() = delete;
    ~Vertex()
    {
        delete ptr;
    }
    [[nodiscard]] inline const float* GetPosition() const
    {
        return ptr;
    }
    [[nodiscard]] inline const float* GetUV() const
    {
        if (type == color)
            throw std::bad_exception();
        return ptr + 3;
    }
    [[nodiscard]] inline const float* GetRGB() const
    {
        if (type == texture)
            throw std::bad_exception();
        return ptr + 3;
    }
    [[nodiscard]] inline Type GetType() const
    {
        return type;
    }
private:
    float* ptr = nullptr;
    Type type;
};


#endif //VERTEX_H
